package com.ist.word.ui;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Insets;
import java.awt.Toolkit;

import javax.swing.ImageIcon;
import javax.swing.JButton;

public class ImageButton extends JButton {
	private String buttonText;
	public  ImageButton() {
		super();
		this.setBorder(null);//remove border
		this.setBackground(new Color(255,255,255,0));
		this.setOpaque(false);
		this.setMargin(new Insets(0, 0, 0, 0));
		this.setIconTextGap(0);//set the gab between text and the image to zero
		this.setBorderPainted(false);//no print border
		this.setFocusPainted(false);//remove text focus border
		this.setContentAreaFilled(false);//remove default background color fill
	}
	//normal
	public void setImage(String imageIconPath) {
		this.setIcon(new ImageIcon(Toolkit.getDefaultToolkit().
				createImage(this.getClass().getResource(imageIconPath))));
	}
	//mouse press
	public void setPressedImage(String imageIconPath) {
		this.setPressedIcon(new ImageIcon(Toolkit.getDefaultToolkit().
				createImage(this.getClass().getResource(imageIconPath))));
	}
	//Mouse in 
	public void setRolloverImage(String imageIconPath) {
		this.setRolloverIcon(new ImageIcon(Toolkit.getDefaultToolkit().
				createImage(this.getClass().getResource(imageIconPath))));
	}
	public String getButtonText() {
		return buttonText;
	}
	public void setButtonText(String buttonText) {
		this.buttonText = buttonText;
	}

}